using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Collectible : MonoBehaviour
{

    public AudioClip collectClip;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    ///<param name="other"></param>
    private void OnTriggerEnter2D(Collider2D other)
    {
        PlayerController pc = other.GetComponent<PlayerController>();
        if (pc!=null)
        {
            if (pc.MyCurrentHealth < pc.MyMaxHealth)
            {  
                pc.ChangeHealth(1);
                AudoManager.instance.AudioPlay(collectClip);
                Destroy(this.gameObject);
            }
        }
    }
}
